package net.entelijan.cobean.examples.showcase.tree;

import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.border.EmptyBorder;

import net.entelijan.cobean.examples.util.ExamplesUtil;
import net.entelijan.scf.DefaultShowcasePanel;
import net.miginfocom.swing.MigLayout;

public class DefaultTreePanel extends DefaultShowcasePanel {

	private JTree tree = new JTree();
	private JButton showSelectionButton = new JButton("Show Selection");
	private JButton collapseAllButton = new JButton("Collapse All");
	private JButton selectRandomItemButton = new JButton("Select Random");

	private static final long serialVersionUID = 1L;

	public DefaultTreePanel() {
		super();
		tree.setBorder(new EmptyBorder(new Insets(5, 5, 5, 5)));
		// Layout the components
		setLayout(new MigLayout());
		add(new JScrollPane(tree), "w max, wrap");
		add(ExamplesUtil.createButtonsPanel(100, this.showSelectionButton,
				this.collapseAllButton, this.selectRandomItemButton));
	}

	public JTree getTree() {
		return tree;
	}

	public void setTree(JTree tree) {
		this.tree = tree;
	}

	public JButton getShowSelectionButton() {
		return showSelectionButton;
	}

	public void setShowSelectionButton(JButton showSelectionButton) {
		this.showSelectionButton = showSelectionButton;
	}

	public JButton getCollapseAllButton() {
		return collapseAllButton;
	}

	public void setCollapseAllButton(JButton collapseAllButton) {
		this.collapseAllButton = collapseAllButton;
	}

	public JButton getSelectRandomItemButton() {
		return selectRandomItemButton;
	}

	public void setSelectRandomItemButton(JButton selectRandomItemButton) {
		this.selectRandomItemButton = selectRandomItemButton;
	}

}
